In recent years, computers included in game systems have become more sophisticated, and therefore a three-dimensional game using three-dimensional computer graphics technique is widespread. In the three-dimensional game, an object, such as a player object or a topography object, represented by a polygon is positioned in a three-dimensional game space, and a state of the game space is displayed as a three-dimensional game screen by using a predetermined point of view.
As one of game apparatuses which display the three-dimensional game screen described above, a game apparatus which allows a virtual camera to follow a movement of a player character is known (for example, Japanese Laid-Open Patent Publication No. 2004-329463 (hereinafter, referred to as Patent Document 1)). More specifically, in the aforementioned game, a character position at which the player character is positioned is set as a target position, and the virtual camera is moved at a speed based on a distance to the target position such that a position (sight point position) of a sight point of the virtual camera approaches the target position at a predetermined rate.
However, the game apparatus disclosed in Patent Document 1 has the following problems. Specifically, a complicated calculation (three-dimensional calculation) based on a three-dimensional game space needs to be performed so as to calculate a movement rate based on a distance to the target position. Therefore, there is a problem that processing load of the game apparatus is increased.
Therefore, a feature of certain exemplary embodiments is to provide a computer-readable storage medium having stored therein a game program and a game apparatus, the game program and the game apparatus enabling reduction of processing load for calculating a movement rate of a virtual camera.
Certain exemplary embodiments have the following aspects to attain the feature mentioned above. The reference numerals, supplementary descriptions, and the like in the parentheses indicate an exemplary correspondence with an exemplary embodiment described below so as to aid in understanding certain exemplary embodiments, and are not intended to be limiting in any way.
A first aspect of certain exemplary embodiments is directed to a computer-readable storage medium having stored therein a game program executed by a computer of a game apparatus for generating a two-dimensional game image representing a state of a three-dimensional game space acquired by a virtual camera so as to display the two-dimensional game image by a display device, and the game program causes the computer to function as: a-number-of-pixels calculation means (S41, S45 to S48); movement rate setting means (S28); and camera movement control means (S3). The-number-of-pixels calculation means calculates a number of pixels included in a linear distance to a target pixel representing a predetermined pixel on the two-dimensional game image, from a sight point pixel representing a pixel on the two-dimensional game image, the sight point pixel corresponding to a sight point of the virtual camera in the three-dimensional game space. The movement rate setting means sets a movement rate of the virtual camera in accordance with the number of pixels calculated by the-number-of-pixels calculation means. The camera movement control means moves the virtual camera to a predetermined position in the three-dimensional game space in accordance with the movement rate having been set by the movement rate setting means.
According to the first aspect, it is possible to set a movement rate of the virtual cameral based on a process of calculating the number of pixels for the two-dimensional game image. Therefore, the movement rate of the virtual camera can be determined without using a complicated calculation for a three-dimensional space, thereby reducing processing load of the computer.
In a second aspect based on the first aspect, the game program causes the computer to further function as: depth value storage means (S21); sight point depth value calculation means (S24); and target pixel detection means (S27, S29). The depth value storage means stores, in a predetermined storage section, a depth value representing a distance of an object displayed on the two-dimensional game image in a depth direction of the three-dimensional game space so as to associate a plurality of the depth values with pixels of the two-dimensional game image, respectively. The sight point depth value calculation means calculates a depth value of the sight point of the virtual camera in the three-dimensional game space. The target pixel detection means compares the depth value calculated by the sight point depth value calculation means with the depth value representing the distance of the object displayed on the two-dimensional game image so as to detect a position of the target pixel in accordance with a comparison result.
According to the second aspect, it is possible to detect a position of the target pixel by using the depth value. Therefore, it is possible to calculate the target pixel without using a complicated three-dimensional calculation, thereby reducing processing load.
In a third aspect based on the second aspect, the game program causes the computer to further function as obstacle determination means (S21 to S26). The obstacle determination means determines whether or not an obstacle is positioned, in the three-dimensional game space, on a straight line connecting between a point of view of the virtual camera and the sight point of the virtual camera. Further, the-number-of-pixels calculation means calculates the number of pixels included in the linear distance from the sight point pixel to the target pixel when the obstacle determination means determines that the obstacle is positioned.
According to the third aspect, when an object is hidden behind an obstacle and is not displayed in the three-dimensional game space, the movement rate of the virtual camera can be determined in accordance with the number of pixels between the target pixel and the sight point pixel.
In a fourth aspect based on the third aspect, the camera movement control means moves the virtual camera, in the three-dimensional game space, to a position, on the straight line connecting between the point of view of the virtual camera and the sight point thereof, at which no obstacle is positioned.
According to the fourth aspect, when an object (an object having the sight point set therein) is hidden behind an obstacle and is not displayed in the three-dimensional game space, the virtual camera is moved at the movement rate based on the number of pixels between the target pixel and the sight point pixel so as to display the object.
In a fifth aspect based on the fourth aspect, the-number-of-pixels calculation means calculates the number of pixels included in a straight line extending vertically upward from the sight point pixel to the target pixel in the two-dimensional game image. Further, the camera movement control means moves the virtual camera upward to a position, on the straight line connecting between the point of view of the virtual camera and the sight point thereof, at which no obstacle is positioned.
According to the fifth aspect, the virtual camera can be moved upward over the obstacle so as to follow the player object, thereby providing a player with a game screen which prevents the player from feeling uncomfortable.
In a sixth aspect based on the third aspect, the sight point is a predetermined point included in a player object representing a subject to be operated by a player.
According to the sixth aspect, it is possible to prevent the player object from being hidden behind the obstacle and being invisible.
In a seventh aspect based on the sixth aspect, the game program causes the computer to further function as projection position calculation means (S22), and depth value difference calculation means (S25). The projection position calculation means calculates a display position at which the player object is to be displayed in a coordinate system of the two-dimensional game image by using projective transformation. The depth value difference calculation means calculates a difference between the depth value calculated by the sight point depth value calculation means and a depth value of a pixel corresponding to a projection position. Further, the obstacle determination means determines that the obstacle is positioned when the difference calculated by the depth value difference calculation means represents a value greater than or equal to a predetermined value.
According to the seventh aspect, it is possible to determine, by using the depth value, whether or not the obstacle is positioned between the virtual camera and the player object having the sight point set therein, thereby reducing processing load of the computer.
In an eighth aspect based on the sixth aspect, the game program causes the computer to further function as distance difference calculation means (S25) for calculating, in the three-dimensional game space, a difference between a distance from the point of view of the virtual camera to the predetermined point included in the player object, and a distance from the point of view of the virtual camera to the obstacle positioned in a direction of the predetermined point included in the player object. Further, the obstacle determination means determines that the obstacle is positioned when the difference calculated by the distance difference calculation means represents a value greater than or equal to a predetermined value.
According to the eighth aspect, the difference between the distances in the three-dimensional game space is used to determine whether or not the obstacle is positioned between the virtual camera and the player object having the sight point set therein. Therefore, determination can be performed with enhanced accuracy.
In a ninth aspect based on the second aspect, the target pixel detection means detects a position of a pixel at which the depth value representing the distance of the object displayed on the two-dimensional game image represents a deeper position than the depth value calculated by the sight point depth value calculation means.
According to the ninth aspect, it is possible to detect a position of the target pixel by using the depth value. Therefore, it is possible to calculate the target pixel without using a complicated three-dimensional calculation, thereby reducing processing load.
In a tenth aspect based on the first aspect, the movement rate setting means sets the movement rate such that the greater the number of pixels calculated by the-number-of-pixels calculation means is, the higher the movement rate is.
According to the tenth aspect, when the moving distance of the virtual camera is long, the movement rate can be increased. When the moving distance of the virtual cameral is short, the movement rate can be reduced. Therefore, the virtual camera can be moved for a similar time period regardless of whether the moving distance of the virtual camera is long or short.
In an eleventh aspect based on the tenth aspect, the movement rate setting means includes acceleration calculation means for calculating a movement acceleration of the virtual camera in accordance with the number of pixels calculated by the-number-of-pixels calculation means. The movement rate setting means calculates and sets the movement rate by using the movement acceleration.
According to the eleventh aspect, an acceleration of the virtual camera is calculated based on the number of pixels having been calculated so as to move the virtual camera by using the acceleration having been calculated. Therefore, the virtual camera can be moved so as to change a game image in such a manner that a player does not feel uncomfortable.
In a twelfth aspect based on the eleventh aspect, the game program causes the computer to further function as: a-number-of-pixels-to-be-returned calculation means (S81, S86 to S89); and camera returning control means (S28). The-number-of-pixels-to-be-returned calculation means calculates a number of pixels included in a linear distance from the sight point pixel to a predetermined pixel, representing a return pixel, on the two-dimensional game image after the virtual camera has been moved by the camera movement control means in accordance with the movement rate based on the movement acceleration, and stops. The camera returning control means moves, when the number of pixels calculated by the-number-of-pixels-to-be-returned calculation means represents a value greater than or equal to a predetermined value, the virtual camera at a predetermined movement rate in a direction opposite to a moving direction in which the camera movement control means has moved the virtual camera.
According to the twelfth aspect, when the virtual camera is moved by using the acceleration, a position to which the virtual camera has been moved can be adjusted. Therefore, it is possible to provide a player with a game image which can be easily viewed by the player.
In a thirteenth aspect based on the twelfth aspect, the camera returning control means moves the virtual camera such that the greater the number of pixels calculated by the-number-of-pixels-to-be-returned calculation means is, the higher the predetermined movement rate for moving the virtual camera is.
According to the thirteenth aspect, when the moving distance of the virtual camera is long, the movement rate can be increased. When the moving distance of the virtual cameral is short, the movement rate can be reduced. Therefore, the virtual camera can be moved for a similar time period regardless of whether the moving distance of the virtual camera is long or short.
In a fourteenth aspect based on the thirteenth aspect, the camera returning control means includes returning acceleration calculation means for calculating a movement acceleration of the virtual camera in accordance with the number of pixels calculated by the-number-of-pixels-to-be-returned calculation means. The camera returning control means moves the virtual camera at the predetermined movement rate based on the movement acceleration.
According to the fourteenth aspect, the virtual camera can be moved so as to change a game image in such a manner that a player does not feel uncomfortable.
A fifteenth aspect of certain exemplary embodiments is directed to a game apparatus for generating a two-dimensional game image representing a state of a three-dimensional game space acquired by a virtual camera so as to display the two-dimensional game image by a display device, and the game apparatus comprises: a-number-of-pixels calculation means; movement rate setting means; and camera movement control means. The-number-of-pixels calculation means calculates a number of pixels included in a linear distance to a target pixel representing a predetermined pixel on the two-dimensional game image, from a sight point pixel representing a pixel on the two-dimensional game image, the sight point pixel corresponding to a sight point of the virtual camera in the three-dimensional game space. The movement rate setting means sets a movement rate of the virtual camera in accordance with the number of pixels calculated by the-number-of-pixels calculation means. The camera movement control means moves the virtual camera to a predetermined position in the three-dimensional game space in accordance with the movement rate having been set by the movement rate setting means.
According to the fifteenth aspect, the same effect as that for the first aspect can be obtained.
According to certain exemplary embodiments, the movement rate of the virtual camera can be determined by using calculation based on a two-dimensional image, thereby enabling reduction of processing load of the CPU and the like. Therefore, even a game apparatus using the CPU and the like which operate at a slow processing speed can process a three-dimensional game which can be easily operated by a player, and provides a screen which is easily viewed by the player.
These and other features, aspects and advantages of certain exemplary embodiments will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings.